package cn.edu.hdu.zmj;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONObject;

@Controller
public class TestController {

	@RequestMapping("")
	@ResponseBody
	public String index() {
		return "welcome to my server-2";
	}
	
	@RequestMapping("/hello")
	@ResponseBody
	public String hello() {
		return "mjchow";
	}
	
	@RequestMapping("getData")
	@ResponseBody
	public String getData() {
		Verify v1 = new Verify(1, "xiaomin1", "zz@tt.com", "88:99:00");
		Verify v2 = new Verify(2, "xiaomin2", "zz@tt.com", "88:99:00");
		Verify v3 = new Verify(3, "xiaomin3", "zz@tt.com", "88:99:00");
		Verify v4 = new Verify(4, "xiaomin4", "zz@tt.com", "88:99:00");
		Verify v5 = new Verify(5, "xiaomin5", "zz@tt.com", "88:99:00");
		List<Verify> verifyList = new ArrayList<Verify>();
		verifyList.add(v1);
		verifyList.add(v2);
		verifyList.add(v3);
		verifyList.add(v4);
		verifyList.add(v5);
		
		String json = JSONObject.toJSON(verifyList).toString();
		return json;
	}
}
